package com.atguigu.guli.edu.controller;

import java.util.Arrays;
import java.util.Map;

import com.atguigu.common_utils.utils.PageUtils;
import com.atguigu.common_utils.utils.R;
import com.atguigu.guli.edu.entity.CourseDescription;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.atguigu.guli.edu.service.EduCourseDescriptionService;




/**
 * 课程简介
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2021-01-19 10:59:18
 */
@RestController
@RequestMapping("edu/educoursedescription")
public class EduCourseDescriptionController {
    @Autowired
    private EduCourseDescriptionService eduCourseDescriptionService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    //@RequiresPermissions("edu:educoursedescription:list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = eduCourseDescriptionService.queryPage(params);

        return R.ok().put("page", page);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{id}")
    //@RequiresPermissions("edu:educoursedescription:info")
    public R info(@PathVariable("id") String id){
        CourseDescription eduCourseDescription = eduCourseDescriptionService.getById(id);

        return R.ok().put("eduCourseDescription", eduCourseDescription);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    //@RequiresPermissions("edu:educoursedescription:save")
    public R save(@RequestBody CourseDescription eduCourseDescription){
		eduCourseDescriptionService.save(eduCourseDescription);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    //@RequiresPermissions("edu:educoursedescription:update")
    public R update(@RequestBody CourseDescription eduCourseDescription){
		eduCourseDescriptionService.updateById(eduCourseDescription);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    //@RequiresPermissions("edu:educoursedescription:delete")
    public R delete(@RequestBody String[] ids){
		eduCourseDescriptionService.removeByIds(Arrays.asList(ids));

        return R.ok();
    }

}
